package com.xoa.controller.party;


import com.xoa.model.party.CommunityQfqz;
import com.xoa.service.party.CommunityQfqzService;
import com.xoa.util.ToJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller
@RequestMapping("/CommunityQfqz")
public class CommunityQfqzController {
        @Autowired
        private CommunityQfqzService communityQfqzService;

    /**
     * 查询
     * @param request
     * @param
     * @param page
     * @param pageSize
     * @return
     */
    @RequestMapping("/select")
    @ResponseBody
    public ToJson select(HttpServletRequest request, CommunityQfqz communityQfqz, Integer page,
                         Integer pageSize, boolean useFlag, String export, HttpServletResponse response){
        return  communityQfqzService.select(request,communityQfqz,page,pageSize,useFlag,export,response);
    }


    /**
     * 修改
     * @param request
     * @param communityQfqz
     * @return
     */
    @RequestMapping("/update")
    @ResponseBody
    public ToJson update(HttpServletRequest request, CommunityQfqz communityQfqz){
//        SimpleDateFormat  format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        try{
//            communityQfqz.setDateTime(format.parse(timeDate));
//        }catch (Exception e){
//            e.printStackTrace();
//        }
        return  communityQfqzService.update(request,communityQfqz);
    }

    /**
     * 删除
     * @param
     * @param
     * @param
     * @param
     * @return
     */
    @RequestMapping("/delete")
    @ResponseBody
    public ToJson delete(Integer qfqzid){
        return  communityQfqzService.delete(qfqzid);
    }


    /**
     * 添加
     * @param request
     * @param communityQfqz
     * @param
     * @param
     * @return
     */
    @RequestMapping("/add")
    @ResponseBody
    public ToJson add(HttpServletRequest request, CommunityQfqz communityQfqz){
//        SimpleDateFormat  format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        try{
//            communityQfqz.setDateTime(format.parse(timeDate));
//        }catch (Exception e){
//            e.printStackTrace();
//        }
        return  communityQfqzService.add(request,communityQfqz);
    }
}
